#include "EditorCore/Actions/SelectAction.h"
#include "Common/Exceptions/ProductException.h"

namespace editor_core {

	SelectAction::SelectAction( Selector* selector, IEntity* entity ) :
		m_entity( entity ),
		m_previouslySelectedEntity( 0 ),
		m_selector( selector )
	{}

	SelectAction::~SelectAction()
	{}

	bool SelectAction::Commit() {
		m_previouslySelectedEntity = m_selector->GetSelectedEntity();
		m_selector->SelectEntity( m_entity );
		return true;
	}

	void SelectAction::Recommit() {
		m_selector->SelectEntity( m_entity );
	}

	void SelectAction::Rollback() {
		m_selector->SelectEntity( m_previouslySelectedEntity );
	}

}
